﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DBViewConfiguration.aspx.cs" 
         Inherits="DevSky.WebParts.DBConnectWP.DBViewConfiguration" MasterPageFile="~/_layouts/dialog.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderDialogHeaderPageTitle"  runat="server">
  dev-sky.net - Database and View Configuration
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
  <SharePoint:CssRegistration ID="CssRegistration1" runat="server" Name="ows.css" />
  <SharePoint:ScriptLink ID="ScriptLink1" Language="javascript" Name="core.js" runat="server" />
  <SharePoint:FormDigest ID="FormDigest1" runat="server" />

  <style type="text/css">
     .ColumnManager
     {
         overflow-y: auto;
         overflow-x: hidden;
         height: 318px;         
     }
    .Label
    {
        font-size: 8pt;
        font-family: Arial;
        padding-right: 6px;         
    }
    .Label span
    {
        height: 15px;
    }
    .Inline 
    {
        float: left;
        text-align: left;
    }
    .Control
    {
        font-size: 10pt;
        font-family: Arial;
    }
    td.Control label
    {
        font-size: 10pt;
        font-family: Arial;
    }
    .TabelCell
    {
        float: left;
        height: 24px;
    }
    .CheckBox
    {
        text-align: center;
    }
    input 
    {
        font-family: Arial;
        font-size: 8pt;
        height: 20px;
    }
    
    .ms-dialogHeaderDescription
    {
        font-size: 14px;
    }
  </style>

  <script type="text/javascript">
      function DetailDialogConfig(source, panel, imgsrc) {
          if (source.checked) {
              document.getElementById(panel).style.display = "block";
              document.getElementById(imgsrc).src = "/_layouts/images/DevSkySolutions/arrow_up.png";
          }
      }
      function OpenMoreSettings(source, panel) {
          if (source.src.endsWith("/_layouts/images/DevSkySolutions/arrow_down.png")) {
              source.src = "/_layouts/images/DevSkySolutions/arrow_up.png";
              document.getElementById(panel).style.display = "block";
          }
          else {
              source.src = "/_layouts/images/DevSkySolutions/arrow_down.png";
              document.getElementById(panel).style.display = "none";
          }
      }
  </script>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderDialogImage" runat="server">
  <img src="/_layouts/images/DevSkySolutions/DlgHeaderLogo.png" height="48px" alt="dev-sky.net Company Logo" />
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderDialogBodyHeaderSection" runat="server"></asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderDialogDescription" runat="server">
  <div id="selectTermDescription" class="none-wordbreak">
    <div class="ms-dialogHeaderDescription">
        Specify your data for the List and dialog view
    </div>
  </div>
</asp:Content>

<%--  http://www.chaholl.com/archive/2010/11/17/using-the-dialog-framework-in-sharepoint-2010.aspx 
      http://www.w3schools.com/aspnet/aspnet_repeater.asp
      http://support.microsoft.com/kb/306154/de
--%>

<asp:Content ID="Content8" ContentPlaceHolderID="PlaceHolderHelpLink" runat="server">

</asp:Content>

<asp:Content ID="Content6" ContentPlaceHolderID="PlaceHolderDialogBodyMainSection" runat="server">
    <table>
        <tr>
            <td nowrap><asp:Label ID="lblUniqueCol" runat="server" Text="ID Column to load detail data:" class="Label" /></td>
            <td><asp:DropDownList ID="ddIDColumn" runat="server"></asp:DropDownList></td>
        </tr>
        <tr>
            <td><asp:Label ID="Label3" runat="server" Text="Context menu support:" class="Label" /></td>
            <td class="Control">
                <asp:CheckBox runat="server" id="chkDelete" Checked="false" Text="Delete entry" />
                <asp:CheckBox runat="server" id="chkNew" Checked="false" Text="New entry" />
                <asp:CheckBox runat="server" id="chkEditMode" Checked="false" Text="Edit entry" />
                <asp:CheckBox runat="server" id="chkReadMode" Checked="false" Text="Read-only form entry" />
                <asp:CheckBox runat="server" id="chkCustomLinks" Checked="false" Text="Custom links (to define)" />
            </td>
        </tr>
        <tr>
            <td class="Label" nowrap>Security settings:</td>
            <td class="Control"><asp:CheckBox runat="server" id="chkUseSPSSecurity" Checked="false" Text="Use internal SharePoint security groups" /></td>
        </tr>
        <tr>
            <td class="Label" nowrap><asp:Label ID="lblDialogTitle" runat="server" Text="Dialog title" /></td>
            <td class="Control"><asp:TextBox runat="server" id="txtDialogTitle" /></td>
        </tr>
    </table>
    <br />
   <div>
    <asp:Repeater runat="server" ID="rptColumns" OnItemCommand="rptColumns_ItemCommand">
        <HeaderTemplate>
          <div style="background-color: Silver; border-bottom: solid 1px black; color: #fff; padding-top: 6px; font-size: 8pt;">
            <div class="TabelCell" style="width: 45px; text-align: center;">Position</div>
            <div class="TabelCell CheckBox" style="width: 35px;">Visible</div>
            <div class="TabelCell" style="width: 140px;">Column Name</div>
            <div class="TabelCell" style="width: 140px;">Display Name</div>
            <div class="TabelCell" style="width: 160px;">Tooltip</div>
            <div class="TabelCell CheckBox" style="width: 45px;">Filterable</div>
            <div class="TabelCell CheckBox" style="width: 55px;">Groupable</div>
            <div class="TabelCell CheckBox" style="width: 45px;">Dialog</div>
            <div style="clear: both;"></div>
          </div>  
          <div class="ColumnManager">
        </HeaderTemplate>
        <ItemTemplate>
           <div>
            <div style="visibility: hidden;">
                <asp:HiddenField ID="hdfUniqueID" runat="server" Value='<%# Eval("UniqueID") %>' />  
            </div>
            <div class="TabelCell" style="width: 45px; text-align: center;">                
                <asp:TextBox ID="txtPosition" runat="server" Text='<%# Eval("Position") %>' Columns="1" Visible="false" />                
                <asp:Literal  ID="litPosition" runat="server" Text='<%# Eval("Position") %>' />                
             </div>
            <div class="TabelCell CheckBox" style="width: 35px;">
                <asp:CheckBox ID="chkIsVisible" runat="server" Checked='<%# Eval("IsVisible")%>' Visible="false" />
                <asp:Image runat="server" ID="imgIsVisible" ImageUrl='<%# "/_layouts/images/DevSkySolutions/" + Eval("IsVisible") + ".png" %>' />                
            </div>
            <div class="TabelCell" style="width: 140px;"><%# DataBinder.Eval(Container.DataItem, "Name")%></div>
            <div class="TabelCell" style="width: 140px;">
                <asp:TextBox ID="txtDisplayName" runat="server" Text='<%# Eval("DisplayName") %>' Columns="19" Visible="false" />                
                <asp:Literal  ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>' />                
            </div>
            <div class="TabelCell" style="width: 160px;">
                <asp:TextBox ID="txtTooltip" runat="server" Text='<%# Eval("Tooltip") %>' Columns="24" Visible="false" />                
                <asp:Literal  ID="litTooltip" runat="server" Text='<%# Eval("Tooltip") %>' />                
            </div>
            <div class="TabelCell CheckBox" style="width: 45px;">
                <asp:CheckBox ID="chkIsSortable" runat="server" Checked='<%# Eval("IsFilterable")%>' Visible="false" />
                <asp:Image runat="server" ID="imgIsSortable" ImageUrl='<%# "/_layouts/images/DevSkySolutions/" + Eval("IsFilterable") + ".png" %>' />  
            </div>
            <div class="TabelCell CheckBox" style="width: 55px;">
                <asp:CheckBox ID="chkIsGroupable" runat="server" Checked='<%# Eval("IsGroupable")%>' Visible="false" />
                <asp:Image runat="server" ID="imgIsGroupable" ImageUrl='<%# "/_layouts/images/DevSkySolutions/" + Eval("IsGroupable") + ".png" %>' />  
            </div>
            <div class="TabelCell CheckBox" style="width: 45px;">
                <asp:CheckBox ID="chkIsDialogVisible" runat="server" Checked='<%# Eval("IsDialogVisible")%>' Visible="false" />
                <asp:Image runat="server" ID="imgIsDialogVisible" ImageUrl='<%# "/_layouts/images/DevSkySolutions/" + Eval("IsDialogVisible") + ".png" %>' />                  
             </div>
            <div class="TabelCellButton">
                <asp:LinkButton ID="btnEdit" runat="server" Text="Edit" CommandName="EditRow" />
                <asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" CommandName="CancelEdit" Visible="false" />
                <asp:Image ImageUrl="/_layouts/images/DevSkySolutions/arrow_down.png" alt="More settings" runat="server" ID="imgDetails" Visible="false" style="margin-left: 7px; cursor: pointer;" />
            </div>
          </div>  
          <div style="clear: both;"></div>
          <asp:Panel runat="server" style="display: none; background-color: silver; padding-left: 8px; padding-bottom: 6px; padding-top: 4px;" id="DetailCfg" >
            <div style="float: left; width: 510px;">
                <div>
                    <asp:Label ID="Label3" runat="server" Text="Lookup Object:" class="Label" Width="80px" />
                    <asp:DropDownList Width="415" runat="server" ID="ddLookupObjects" AutoPostBack="true" OnSelectedIndexChanged="ddLookupObjects_SelectedIndexChanged" ></asp:DropDownList>
                </div>
                <div>
                    <asp:Label ID="Label4" runat="server" Text="Key Field:" class="Label" Width="80px" />
                    <asp:DropDownList Width="415" runat="server" ID="ddLookupKeyField"></asp:DropDownList>
                </div>
                <div>
                    <asp:Label ID="Label5" runat="server" Text="Value Field:" class="Label" Width="80px" />
                    <asp:DropDownList Width="415" runat="server" ID="ddLookupValueField"></asp:DropDownList>
                </div>
            </div>    
            <div style="float: left; border-left: solid 1px gray; padding-left: 5px;">
                <div>
                    <asp:Label ID="lblShowAs" runat="server" Text="Show list as:" class="Label" Width="75px" style="margin-left: 4px;" />
                    <asp:DropDownList ID="ddShowAs" runat="server">
                        <asp:ListItem Text="Please select ..." Selected="False" Value="NONE"></asp:ListItem>
                        <asp:ListItem Text="DropDown List" Selected="False" Value="DROPDOWN"></asp:ListItem>
                        <asp:ListItem Text="Radion button List" Selected="False" Value="RADIOBUTTON"></asp:ListItem>
                        <asp:ListItem Text="CheckBox List" Selected="False" Value="CHECKBOX"></asp:ListItem>
                    </asp:DropDownList>
                </div>
                <div><asp:CheckBox ID="chkMultipleValues" runat="server" Text="Multiple values allowed" /></div>
                <div><asp:CheckBox ID="chkAddEmptyEntry" runat="server" Text="Add empty entry" /></div>
            </div>        
            <div style="clear: both;"></div>   
            <div style="padding-top: 6px;">
                <div class="Inline">
                    <asp:Label ID="lblFieldValidationError" runat="server" Text="Field Validation error message" width="170"></asp:Label>
                    <asp:TextBox runat="server" ID="txtErrorMessage" Width="300" Text='<%# Eval("ErrorMessage") %>'></asp:TextBox>
                </div>
                <div class="Control Inline" style="padding-left: 8px;"><asp:CheckBox Checked='<%# Eval("IsRequired")%>' ID="chkIsRequired" runat="server" Text="Required Field" /></div>
                <div style="clear: both;"></div>  
                <div>
                    <asp:Label ID="Label2" runat="server" Text="Regular Expression for validation" width="170" />
                    <asp:TextBox ID="txtRegularExpression" runat="server" Width="300" Text='<%# Eval("RegularExpression") %>'></asp:TextBox>
                </div>   
                <div>
                    <asp:Label ID="lblInputFormat" runat="server" Text="Input format mask" width="170"></asp:Label>
                    <asp:TextBox runat="server" ID="txtInputFormat" Width="300" Text='<%# Eval("InputFormat") %>'></asp:TextBox>
                </div>             
            </div>
            <div style="clear: both;"></div>
          </asp:Panel>
        </ItemTemplate>
        <SeparatorTemplate>
            <div style="clear: both;"></div>
        </SeparatorTemplate> 
        <FooterTemplate>
            </div>
        </FooterTemplate>
    </asp:Repeater>
  </div>
</asp:Content>
